import java.util.HashMap;

public class Main {
    public static void main(String[] args) {
        System.out.println("Hello world!");
    }
    //最⻓等差数列
    public int longestArithSeqLength(int[] nums) {
        int n=nums.length;
        HashMap<Integer,Integer> map=new HashMap<>();
        int[][] dp=new int[n][n];
        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                dp[i][j]=2;
            }
        }
        int ret=2;
        for(int i=0;i<n-1;i++){
            for(int j=i+1;j<n;j++){
                int a=2 * nums[i] - nums[j];
                if(map.containsKey(a)){
                    dp[i][j]=dp[map.get(a)][i] + 1;
                    ret=Math.max(ret,dp[i][j]);
                }

            }
            map.put(nums[i],i);
        }
        return ret;
    }
}